<template>
	<view id="memberManagement">
		<uni-Search class="mSearch-input-box" :mode="2" button="inside" placeholder="姓名、机构名或证件号" @search="searchName(false)" @reset="resetMember"  @confirm="searchName(false)" v-model="txtName"></uni-Search>
		<view class="grid-bar" :column="4" :square="false" :show-border="false">
			<view class="grid-bar-item">
				<picker :value="indexOfOrg" @change="changeOrg" :range="org" range-key="text" >
					<button class="button" size="mini">{{org[indexOfOrg].text}}
						<uni-icons class="icon" color="" size="8" type="arrowdown"></uni-icons>
					</button>
				</picker>
			</view>
			<view class="grid-bar-item">
				<picker :value="indexOfGender" @change="changeGender" :range="gender" range-key="text">
					<button class="button" size="mini">{{gender[indexOfGender].text}}
						<uni-icons class="icon" color="" size="8" type="arrowdown"></uni-icons>
					</button>
				</picker>
			</view>
			<view class="grid-bar-item">
				<!-- <picker mode="multiSelector" value="indexOfRank" :range="showRank?newRank:rank"@columnchange="changeRank" range-key="type_name"> -->
				<uni-QSpicker type="custom2" ref="rankPicker" pickerId="custom2_2" :dataSet="rankSet" showReset @confirm="changeRank($event)" />
					<button class="button" size="mini" @tap="changeShow('rankPicker')">{{showRank?minRank+"至"+maxRank:"级别"}}
						<uni-icons class="icon" color="" size="8" type="arrowdown"></uni-icons>
					</button>
			</view>
			<view class="grid-bar-item">
				<!-- <picker :value="indexOfTime" :range="time" range-key="text"> -->
				<picker :value="indexOfOutTime" @change="changeTime" range-key="text" :range="showOutTime?newOutTime:outTime">
					<button class="button" size="mini" @click='changeTimeArray'>{{firstShowOuttime?newOutTime[indexOfOutTime].text:outTime[indexOfOutTime].text}}
						<uni-icons class="icon" color="" size="8" type="arrowdown"></uni-icons>
					</button>
				</picker>
			</view>
		</view>
		<view class="container" v-if="showContainer&&memberData.length>0">
			<uni-member 
				:allSelectFlag="allSelectFlag"
				:memberList="memberData"
				:orgChess="orgChess"
				@toPay="toPay"
				@toChangeRadio="changeRadio"
				@toChangeAllocation='changeAllocation'
				@toMemberDetail="memberDetail"
				@toCheckMember="toCheckMember"
				>
			</uni-member>
			<uni-load-more 
				v-if="isLoading"
				:status="loadingStatus" 
				iconType='auto' 
				:showIcon='showIcon'>
				</uni-load-more>
		</view>
		<view class="nodata" v-if="memberData.length==0&&nodata">
			<view class="msfont ms-wushuju">			
			</view>
			<view class="">
				无数据
			</view>
		</view>
		<view class="block">
			<uni-QSpicker class='allocation' title="会员分配"  type="custom"  ref="chessPicker" pickerId="custom_1" :dataSet="allocationChess" showReset @confirm="changeChess($event)"/>
		</view>
		<view class="bottom">
			<button  type="primary" size="default" v-if="allSelectFlag" class="selectBtn" @click.stop="selectSwitch">选择</button>
		</view>
		<view class="footer">
			<bottom-nav
				v-if="allSelectFlag==false"
				class="bottomnav"
				:fill="true" 
				:options="options" 
				@click="bottomClick">
			</bottom-nav>
		</view>
	</view>
</template>
<script>
	import {
		rankExtent,memberList,memberAllocation,allocationChess,chessCost,yearOrder,pay
	} from "@/common/api.js"
	import uniGrid from "@/components/uni-grid/uni-grid.vue"
	import uniGridItem from "@/components/uni-grid-item/uni-grid-item.vue"
	import uniIcons from '@/components/uni-icons/uni-icons.vue'
	import uniCard from '@/components/uni-card/uni-card.vue'
	import bottomNav from '@/components/bottom-nav/bottom-nav.vue'
	import uniMember from "@/components/uni-event/uni-member.vue"
	import uniSearch from "@/components/uni-search/uni-search.vue"
	import uniQSpicker from "@/components/uni-QSpicker/QuShe-picker.vue"
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
	import uniPopup from "@/components/uni-popup/uni-popup.vue";
	export default {
		name: "memberManagement",
		data() {
			return {
				org: [
					{
						text: '全部机构'
					},
					{
						text: '本机构'
					},
					{
						text: '非本机构'
					}
				],
				indexOfOrg: 1,
				gender: [{
						text: '性别'
					},
					{
						text: '男'
					},
					{
						text: '女'
					},
				],
				indexOfGender: 0,
				outTime: [{
						text: "是否过期"
					},
					{
						text: '全部'
					},
					{
						text: '过期'
					},
					{
						text: "未过期"
					}
				],
				newOutTime: [{
						text: '全部'
					},
					{
						text: '过期'
					},
					{
						text: "未过期"
					}
				],
				indexOfOutTime: 0,
				memberData:[],
				rankSet: {
					itemObject: {
						step_1: [],
						step_2: []
					},
					steps: {
						step_1_value: "type_name", //第一级显示的属性名
						step_2_value: "type_name", //第二级显示的属性名
						step_3_value: "type_name" //第三级显示的属性名
					},
					defaultValue: [0, 0], //初始数据
					linkageNum: 2, //3 表示为3级联动
					linkage: true //true 表示开启联动
				},
				minRank:"",
				maxRank:"",
				minRank_value:"",
				maxRank_value:"",
				indexOfRank: [0,0,0],
				allSelectFlag: true,
				options: [{
					icon: 'msfont ms-quxiao',
					text: '取消'
				}, {
					icon: 'msfont ms-fenpei',
					text: '分配'
				}, {
					icon: 'msfont ms-jiaofei',
					text: '缴费'
				}],
				showOrg: false, //显示棋协筛选
				showGender: false, //显示性别筛选
				showRank: false, //显示级别筛选
				showOutTime: false, //显示过期筛选
				txtName:"",  //搜索会员
				nodata:false,
				page:{
					currentPage:1,
					pageSize:7
				},
				isLoading:false,
				loadingStatus:"more",
				showIcon:true,  //是否正在加载
				screenChess:false,
				allocationChess:{
					itemArray: [],
					defaultValue: 0, //初始数据
					steps: {
						step_1_value: "org_name"
					}
				},
				chessIDs:'',
				org_id:"",
				showAllocation:false,
				memberRadio:[],
				yearCost:0,
				yearCost_member:[],
				showContainer:true,
				firstShowOrg:false,
				// firstShowRank:false,
				firstShowOuttime:false,
				firstShowGender:false,
				pay_id:''
			};
		},
		components: {
			uniGrid,
			uniGridItem,
			uniIcons,
			uniCard,
			bottomNav,
			uniMember,
			uniSearch,
			uniQSpicker,
			uniLoadMore
		},
		created() {
			// var _this = this;
			// _this.page.currentPage=1;
			// _this.changeOrgArray();
			// // _this.changeGenderArray();
			// _this.changeTimeArray();
			// _this.getRankExtent();
			// _this.getMemberData();
			// _this.getAllocationChess()
			// _this.getChessCost()
			// setTimeout(function(){
			// 	_this.nodata=true;
			// },1000)
		},
		onShow() {
			var _this = this;
			_this.page.currentPage=1;
			_this.changeOrgArray();
			// _this.changeGenderArray();
			_this.changeTimeArray();
			_this.getRankExtent();
			_this.getMemberData();
			_this.getAllocationChess()
			_this.getChessCost()
			setTimeout(function(){
				_this.nodata=true;
			},1000)
		},
		onReachBottom() {
			// _this.page.currentPage+=1;
			var _this=this,data=_this.screenMember();
			console.log(_this.page.currentPage)
			_this.getMemberApi(data).then(function(e){
				if(e.errcode==0){
					if(e.data.length>0){
						var org_id=uni.getStorageSync('account')['org_id'];
						e.data.map(function(item,index){
							item.gender=item.sex==0?"男":"女"
							item.check_status=item.fees_end!=null?_this.checkState(_this.quarter(item.fees_end),item.state):"";
							item.txt_status=item.fees_end!=null?_this.txt_checkstatus(_this.quarter(item.fees_end),item.state)['text']:""
							item.sign_time=item.fees_end == null ?'未缴费注册': _this.formatDate(item.fees_end).slice(0, 10);
							item.status_value=item.fees_end!=null?_this.txt_checkstatus(_this.quarter(item.fees_end),item.state)['value']:"";
							item.myselfOrg=item.org_id==org_id?"0":"1"
							item.radio=0;
							if(item.state==1){
								item.noEvent='warning'
							}
							item.isPay=false;
							// if(_this.memberData.indexOf(item.id)==-1){
							// 	_this.memberData=_this.memberData.concat(e.data);
							// }
						})
						_this.page.currentPage+=1;
						_this.memberData=_this.memberData.concat(e.data);
						_this.isLoading=Number(e.total)>_this.memberData.length?true:false;
						_this.loadingStatus=Number(e.total)>_this.memberData.length?"loading":"noMore";
					}
				}
			})
		},
		onPullDownRefresh() {
			var _this=this;
			_this.page.currentPage=1;
			_this.getMemberData()
			setTimeout(function(){
				uni.stopPullDownRefresh()
			},1000)
		},
		methods: {
			//获取级别范围
			getRankExtent() {
				var _this = this;
				//测试
					// _this.rankSet.itemObject.step_1.push({type_name:'1级'},{type_name:"2级"})
					// _this.rankSet.itemObject.step_2.push([{type_name:'2级'},{type_name:"1级"}],[{type_name:'3级'},{type_name:"4级"}])
					
				rankExtent().then(function(res) {
					var e = res.data;
					if (e.errcode == 0) {
						var rank_arr=[],ranks=[];
						if (e.data.length > 0) {
							e.data.map(function(item, index) {
								_this.rankSet.itemObject.step_1.push(item)
							})
							var list=e.data.reverse();
							list.map(function(item,index){
								ranks.push(item)
								rank_arr.push(ranks.filter(function(items,indexs){
											return indexs<=index
								}))
							})
							_this.rankSet.itemObject.step_2=rank_arr.reverse()
						}
					}
				})
			},
			//筛选
			screenMember(){
				var _this=this,orgType='',gender='',outtime="";
				switch (_this.indexOfOrg){
					case 1:
						 orgType="myself";break;
					case 2:
						 orgType="other";break;
					case 3:
							orgType="all";break;
					default:
							orgType="all";break;
				}
				switch (_this.indexOfGender){
					case 1:
						gender=0;break;
					case 2:
						gender=1;break;
					case 3:
						gender="";break;
					default: 
						gender='';break;
				}
				switch (_this.indexOfOutTime){
					case 1:outtime=1
						break;
					case 2:outtime=2
						break;
					case 3:outtime=''
						break;
					default:outtime=""
						break;
				}
				if(_this.minRank!=""&&_this.maxRank!=""){
					return {
						keywords:_this.txtName?_this.txtName:"",
						type:orgType,
						sex:gender,
						fees_type:outtime,
						page:_this.page.currentPage,
						pageSize:_this.page.pageSize,
						min_level:_this.minRank_value,
						max_level:_this.maxRank_value,
						keywords:_this.txtName.trim(),
						state:7
					}
				}else{
					return {
						keywords:_this.txtName?_this.txtName:"",
						type:orgType,
						sex:gender,
						fees_type:outtime,
						page:_this.page.currentPage,
						pageSize:_this.page.pageSize,
						keywords:_this.txtName.trim(),
						state:7
					}
				}
			},
			resetMember(){
				var _this=this;
				_this.txtName="";
				_this.page.currentPage=1;
				_this.getMemberData()
			},
			getMemberData(){
				//测试
				var _this=this,data={};
				data=_this.screenMember();
				_this.getMemberApi(data).then(function(e){
					_this.memberData=[];
					if(e.errcode==0){
						if(e.data.length>0){
							var org_id=uni.getStorageSync('account')['org_id'];
							e.data.map(function(item,index){
								item.gender=item.sex==0?"男":"女"
								item.check_status=item.fees_end!=null?_this.checkState(_this.quarter(item.fees_end),item.state):"";
								item.txt_status=item.fees_end!=null?_this.txt_checkstatus(_this.quarter(item.fees_end),item.state)['text']:""
								item.sign_time=item.fees_end == null ?'未缴费注册': _this.formatDate(item.fees_end).slice(0, 10);
								item.status_value=item.fees_end!=null?_this.txt_checkstatus(_this.quarter(item.fees_end),item.state)['value']:"";
								item.myselfOrg=item.org_id==org_id?"0":"1"
								if(item.state==1){
									item.noEvent='warning'
								}
								item.radio=0;
								item.isPay=false;
								// if(_this.memberData.indexOf(item.id)==-1){
								// 	_this.memberData.push(item)
								// }
							});
							_this.memberData=e.data;
							_this.isLoading=Number(e.total)>_this.memberData.length?true:false;
							_this.loadingStatus=Number(e.total)>_this.memberData.length?"loading":"noMore";
							if(_this.page.currentPage==1){
								_this.page.currentPage=2
							}
						}
					}
				})
			},
			getMemberApi(data){
				var _this=this;
				var promise=new Promise(function(resolve,reject){
					memberList(data).then(function(res){
						var e=res.data;
							if(e.errcode==0){
								resolve(e)
						}else if(e.errcode==1000||e.errcode==1001){
							uni.removeStorageSync('token');
							uni.reLaunch({
								url:'/pages/home/welcome'
							})
						}else{
							uni.showToast({
								position: 'center',
								icon: 'none',
								title:e.msg
							});
						}
					})
				})
				return promise;
			},
			formatDate(t){
			  let _t = ''
			  if (typeof t === 'string') {
			    const yy = t.substring(0, 4)
			    const MM = t.substring(5, 7) - 1
			    const dd = t.substring(8, 10)
			    const hh = t.substring(11, 13)
			    const mm = t.substring(14, 16)
			    const ss = t.substring(17, 19)
			    _t = new Date(yy, MM, dd, hh, mm, ss)
			  } else {
			    _t = t
			  }
			  const f = (a) => {
			    return a < 10 ? '0' + a : a
			  }
			  return _t.getFullYear() + '-' + f(_t.getMonth() + 1) + '-' + f(_t.getDate()) + ' ' + f(_t.getHours()) + ': ' + f(_t.getMinutes())
			},
			quarter(t){
				// console.log(t)
			  const yy = t.substring(0, 4)
			  const MM = t.substring(5, 7) - 1
			  const dd = t.substring(8, 10)
			  const hh = t.substring(11, 13)
			  const mm = t.substring(14, 16)
			  const ss = t.substring(17, 19)
			  const _t = new Date(yy, MM, dd, hh, mm, ss)
			  const M = _t.getMonth() + 1
			  const f = (w) => {
			    const y = _t.getFullYear()
			    return new Date(y, w, 1, 0, 0, 0)
			  }
			  if (M >= 1 && M <= 3) {
			    return f(0)
			  } else if (M >= 4 && M <= 6) {
			    return f(3)
			  } else if (M >= 7 && M <= 9) {
			    return f(6)
			  } else if (M >= 10 && M <= 12) {
			    return f(9)
			  }
			},
			checkState(t,state){
			  const that = this;
				if (new Date().getTime() <= new Date(t)) {
			    return ['success', '正常']
			  } else if (new Date().getTime() > new Date(t)) {
			    return ['warning', '过期']
			  }else if(state==1){
					return ['warning', '已禁用']
				}
			},
			txt_checkstatus(t,state){
				var _this=this;
				if ( state==2&&(new Date().getTime() <= new Date(t))) {
				  return {text:'已审核',value:0};
				} else if (state==2&&(new Date().getTime() > new Date(t))) {
				  return {text:'过期',value:1};
				}else if(state==1){
					return {text:'已禁用',value:2};
				}else if(state==4){
					return {text:'待审核',value:3};
				}else if(state==8){
					return {text:'审核失败',value:4};
				}
			},
			changeShow(name) {
				this.$refs[name].show();
			},
			//切换棋协
			changeOrg(e) {
				var _this=this;
				_this.firstShowOrg=true;
				_this.indexOfOrg = Number(e.target.value);
				_this.page.currentPage=1;
				_this.getMemberData()
				_this.showContainer=false;
				uni.showLoading({
					title:"加载中..."
				})
				setTimeout(function(){
					uni.hideLoading();
					_this.showContainer=true;
				},1500)
			},
			changeOrgArray() {
				var _this = this;
				_this.showOrg=true;
			},
			//切换性别
			changeGender(e) {
				var _this=this;
				_this.indexOfGender = Number(e.target.value)
				_this.page.currentPage=1;
				_this.getMemberData()
				_this.showContainer=false;
				uni.showLoading({
					title:"加载中..."
				})
				setTimeout(function(){
					uni.hideLoading();
					_this.showContainer=true;
				},1500)
			},
			//切换级别
			changeRank(e) {
				var _this=this;
				_this.showRank=true;
				_this.minRank=e.data.steps1.type_name;
				_this.maxRank=e.data.steps2.type_name;
				_this.minRank_value=e.data.steps1.event_value;
				_this.maxRank_value=e.data.steps2.event_value;
				_this.page.currentPage=1;
				_this.getMemberData()
				_this.showContainer=false;
				uni.showLoading({
					title:"加载中..."
				})
				setTimeout(function(){
					uni.hideLoading();
					_this.showContainer=true;
				},1500)
			},
			// changeRankArray() {
			// 	var _this = this;
			// 	_this.showRank = true;
			// },
			//切换时间
			changeTime(e) {
				var _this=this;
				_this.firstShowOuttime=true;
				_this.indexOfOutTime = Number(e.target.value)
				_this.page.currentPage=1;
				_this.getMemberData()
				_this.showContainer=false;
				uni.showLoading({
					title:"加载中..."
				})
				setTimeout(function(){
					uni.hideLoading();
					_this.showContainer=true;
				},1500)
			},
			changeTimeArray() {
				var _this = this;
				_this.showOutTime = true;
			},
			search(res) {

			},
			cancel(res) {
				res.value
			},
			searchName(){
				var _this=this;
				_this.page.currentPage=1;
				_this.getMemberData()
				_this.showContainer=false;
				uni.showLoading({
					title:"加载中..."
				})
				setTimeout(function(){
					uni.hideLoading();
					_this.showContainer=true;
				},1500)
			},
			selectSwitch() {
				this.allSelectFlag = false;
			},
			bottomClick(e) {
				var _this=this;
				var index = e.index;
				switch (index) {
					//点击取消
					case 0:
						this.allSelectFlag = true;
						break;
						//点击分配
					case 1:
						var memberRadio=[],ids="";
						_this.memberData.map(function(item,index){
							if(item.radio==1){
								memberRadio.push(item.id)
							}
						})
						if(memberRadio.length==0){
							uni.showToast({
								title:"请选择分配会员",
								icon:"none"
							})
							return;
						}
						_this.$refs["chessPicker"].show();
						_this.memberRadio=memberRadio;
						break;
					case 2:
						var memberRadio=[],ids="";
						_this.memberData.map(function(item,index){
							if(item.radio==1){
								memberRadio.push(item.id)
							}
						})
						if(memberRadio.length==0){
							uni.showToast({
								title:"请选择缴费会员",
								icon:"none"
							})
							return;
						}
						_this.yearCost_member=memberRadio;
						_this.getYearOrder()
						// console.log(_this.yearCost_member)
						break;
				}
			},
			changeRadio(e,index) {
				var _this=this;
				if(e==0){
					_this.memberData[index]['radio']=1;
				}else{
					_this.memberData[index]['radio']=0;
				}
			},
			changeAllocation(e,id){
				var _this=this;
				this.$refs[e].show();
				_this.memberRadio=[];
				_this.memberRadio.push(id)
			},
			//点击分配
			getAllocationChess(){
				var _this=this,data={
					type:"branch",
					fields:"id,org_name,org_level"
				};				
				allocationChess(data).then(function(res){
					var e=res.data;
					if(e.errcode==0){
							_this.allocationChess.itemArray.push(e.data);
					}else if(e.errcode==1000||e.errcode==1001){
						uni.removeStorageSync('token');
						uni.reLaunch({
							url:'/pages/home/welcome'
						})
					}else{
						uni.showToast({
							position: 'center',
							icon: 'none',
							title:e.msg
						});
					}
				})
			},
			//分配棋协
			changeChess(e){
				var _this=this,data={};
				data={
					ids:_this.memberRadio.toString(),
					org_id:e.data[0].id
				}
				memberAllocation(data).then(function(res){
					var e=res.data;
					if(e.errcode==0){
						_this.allSelectFlag=true;
						uni.showModal({
							title: '',
							content: "棋协分配成功！",
							showCancel:false,
							confirmText:"确认",
							confirmColor:"#2680EB",
							success(res) {
								if(res.confirm){
									_this.allSelectFlag=true;
									_this.page.currentPage=1;
									_this.memberData=[];
									_this.getMemberData()
								}
							}
						});
					}else if(e.errcode==1000||e.errcode==1001){
							uni.removeStorageSync('token');
							uni.reLaunch({
								url:'/pages/home/welcome'
							})
						}else{
							uni.showToast({
								position: 'center',
								icon: 'none',
								title:e.msg
							});
						}
				})
			},
			//会员详情
			memberDetail(id){
				var _this=this;
				uni.navigateTo({
					url:"/pages/memberManagement/memberCheckedDetail?id="+id
				})
			},
			//审核详情
			toCheckMember(id){
				uni.navigateTo({
					url:"/pages/memberManagement/memberNoCheckDetail?id="+id
				})
			},
			//获取棋协费用
			getChessCost(){
				var _this=this,data={};
				chessCost(data).then(function(res){
					var e=res.data;
					if(e.errcode==0){
						_this.yearCost=e.data.filter(function(item,index){
							return item.mark=='年费'
						})[0]["price"]
						// console.log(_this.yearCost)
					}else if(e.errcode==1000||e.errcode==1001){
							uni.removeStorageSync('token');
							uni.reLaunch({
								url:'/pages/home/welcome'
							})
						}else{
							uni.showToast({
								position: 'center',
								icon: 'none',
								title:e.msg
							});
						}
				})
			},
			//年费订单
			getYearOrder(){
				var _this=this,data={},yearcost=0,sumYearCost=0;
				yearcost=parseFloat(_this.yearCost*100)/100
				sumYearCost=(_this.yearCost_member.length*yearcost).toFixed(2)
				// console.log(sumYearCost)
				data={
					cost:String(sumYearCost),
					ids:_this.yearCost_member.toString()
				}
				yearOrder(data).then(function(res){
					var e=res.data;
					if(e.errcode==0){
						// _this.allSelectFlag=false;
						if(e.state==0){
							_this.getPayConfig(e.data);
						}else if(e.state==1){
							uni.showModal({
								title: '',
								content: "缴费成功!",
								showCancel:false,
								confirmText:"确认",
								confirmColor:"#2680EB",
								success(res) {
									if(res.confirm){
										_this.allSelectFlag=true;
										_this.page.currentPage=1;
										_this.nodata=false;
										_this.memberData=[];
										_this.getMemberData()
									}
								}
							});
						}
					}else if(e.errcode==1000||e.errcode==1001){
							uni.removeStorageSync('token');
							uni.reLaunch({
								url:'/pages/home/welcome'
							})
						}else{
							uni.showToast({
								position: 'center',
								icon: 'none',
								title:e.msg
							});
						}
				})
				
				//测试
				// var order_id="2019122317010107140258"
				// _this.getPayConfig(order_id);
			},
			getPayConfig(orderid){
				var _this=this,data={};
				if(uni.getStorageSync("account")&&uni.getStorageSync("account")!=null){
					var openid=uni.getStorageSync("account").openid;
					data={
						order_id:orderid,
						type:"ms",
						openid:openid
					}
				}
				pay(data).then(function(res){
						var e=res.data;
						if(e.errcode==0){
							uni.requestPayment({
							    provider: 'wxpay',
							    timeStamp: String(e.data.timeStamp),
							    nonceStr: e.data.nonceStr,
							    package: 'prepay_id='+e.data.package,
							    signType: 'MD5',
							    paySign: e.data.paySign,
							    success: function (res) {
							        // console.log('success:' + JSON.stringify(res));
											_this.nodata=false;
											_this.allSelectFlag=true;
											_this.page.currentPage=1;
											_this.memberData=[];
											_this.getMemberData();
							    },
							    fail: function (err) {
							        // console.log('fail:' + JSON.stringify(err));
											_this.allSelectFlag=true;
											uni.showModal({
												title: '',
												content: "支付失败!",
												showCancel:false,
												confirmText:"取消",
												confirmColor:"#2680EB",
												success(res) {
													if(res.confirm){
														_this.memberData.map(function(item){
															if(item.id==_this.pay_id){
																item.isPay=false;
															}
														})
													}
												}
											});
							    }
							});
						}else if(e.errcode==1000||e.errcode==1001){
								uni.removeStorageSync('token');
								uni.reLaunch({
									url:'/pages/home/welcome'
								})
							}else{
								uni.showToast({
									position: 'center',
									icon: 'none',
									title:e.msg
								});
							}
				})
			},
			toPay(item,index){
				var _this=this;
				_this.pay_id=item.id
				if(item.isPay==false){
					_this.memberData.map(function(items){
						if(items.id==item.id){
							items.isPay=true;
						}
					})
					_this.yearCost_member=[];
					_this.yearCost_member.push(item.id);
					_this.getYearOrder();
				}
			}
		}
	};
</script>
<style lang="scss" scoped>
	#memberManagement {
		position: relative;
		height: 100%;
		.searchBar {}
		.grid-bar {
			display: flex;
			flex-direction: row;
			background: #fff;
			justify-content: space-around;
			height: 70rpx;
			.grid-bar-item {
				height: 60rpx;
				.button {
					// height: 50rpx;
					padding: 0;
					background: #fff;
					color: #676767;
					&:after {
						border-color: transparent;
					}
					.icon {
						margin-left: 10rpx;
					}
				}
			}
		}
		.serach .content .content-box .input.center{
			width: 300rpx !important;
		}
		.container {
			padding-bottom: 25rpx;
		}
		.nodata{
			position: fixed;
			top: 50%;
			left: 50%;
			margin-left: -117rpx;
			margin-top: -147rpx;
			.ms-wushuju{
				font-size: 150rpx;
				color: #ccc;
			}
			view:last-child{
				color: #aaa;
				text-align: center;
				margin-left: -20rpx;
				margin-top: -55rpx;
				font-size: 40rpx;
			}
		}
		.block {
			height: 90rpx;
		}
		.bottom {
			position: fixed;
			bottom: 20rpx;
			left: 0;
			right: 0;
			margin:0 30rpx;
			background: #fff;
			z-index: 999;
			display: flex;
			align-items: center;
			.selectBtn {
				width: 100%;
				font-size: 30rpx;
				background: #1A66FF;
			}
		}
		.footer {
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			background: #fff;
			z-index: 999;
			display: flex;
			align-items: center;
			.bottomnav{
				width: 100%;
			}
		}
	}
</style>
